<?php

/**
 * BecaOtorgada form base class.
 *
 * @method BecaOtorgada getObject() Returns the current form's model object
 *
 * @package    BecArTe
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBecaOtorgadaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'fecha'        => new sfWidgetFormDate(),
      'estado'       => new sfWidgetFormChoice(array('choices' => array('Otorgada' => 'Otorgada', 'Vigente' => 'Vigente', 'Finalizada' => 'Finalizada'))),
      'alumno_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('beneficiario'), 'add_empty' => false)),
      'solicitud_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('solicitud'), 'add_empty' => false)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
      'created_by'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'add_empty' => true)),
      'updated_by'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'add_empty' => true)),
      'version'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'fecha'        => new sfValidatorDate(),
      'estado'       => new sfValidatorChoice(array('choices' => array(0 => 'Otorgada', 1 => 'Vigente', 2 => 'Finalizada'), 'required' => false)),
      'alumno_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('beneficiario'))),
      'solicitud_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('solicitud'))),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
      'created_by'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'required' => false)),
      'updated_by'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'required' => false)),
      'version'      => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('beca_otorgada[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BecaOtorgada';
  }

}
